package svc

import (
	"activity_srv/internal/baidu"
	"activity_srv/internal/config"
	"github.com/zeromicro/go-zero/zrpc"
	"homepage_srv/homepageclient"
	"user_srv/userclient"
)

type ServiceContext struct {
	Config   config.Config
	UserSrv  userclient.User
	HomePage homepageclient.Homepage
	BaiduMap *baidu.Client
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:   c,
		UserSrv:  userclient.NewUser(zrpc.MustNewClient(c.UserSrv)),
		HomePage: homepageclient.NewHomepage(zrpc.MustNewClient(c.HomePage)),
		BaiduMap: baidu.NewClient(c.BaiduMap.AK),
	}
}
